package com.stylefeng.guns.modular.map.model;

import com.stylefeng.guns.modular.area.model.BdapAreaPopPropHm;
import com.stylefeng.guns.modular.area.model.BdapAreaPopPropQm;
import com.stylefeng.guns.modular.area.model.BdapSubareaPopPropHm;
import com.stylefeng.guns.modular.area.model.BdapSubareaPopPropQm;

public class PassengerFlowUtil {
	/**
	 * 区域未来一小时客流预测
	 * @Description: TODO
	 * @param @param nowareaPopPropHm
	 * @param @param areaPopPropHmbefore
	 * @param @return   
	 * @return String  
	 * @throws
	 * @author zhangyaoyao
	 * @date 2018年3月23日
	 */
	public static String getAreaNextHourUc(BdapAreaPopPropHm nowareaPopPropHm,
			BdapAreaPopPropHm areaPopPropHmbefore) {
		if (areaPopPropHmbefore == null || nowareaPopPropHm == null) {
			return "暂无";
		}
		double nowUc = Double.parseDouble(nowareaPopPropHm.getTotalUsers());
		double beforeUc = Double.parseDouble(areaPopPropHmbefore
				.getTotalUsers());
		if (nowUc == 0 || beforeUc == 0) {
			return String.valueOf(nowUc);
		} else {
			return String.valueOf(nowUc / beforeUc * nowUc).split("\\.")[0];
		}
	}
	/**
	 * 子区域未来一小时客流预测
	 * @Description: TODO
	 * @param @param nowareaPopPropHm
	 * @param @param areaPopPropHmbefore
	 * @param @return   
	 * @return String  
	 * @throws
	 * @author zhangyaoyao
	 * @date 2018年3月23日
	 */
	public static String getSubAreaNextHourUc(BdapSubareaPopPropHm nowareaPopPropHm,
			BdapSubareaPopPropHm areaPopPropHmbefore) {
		if (areaPopPropHmbefore == null || nowareaPopPropHm == null) {
			return "暂无";
		}
		double nowUc = Double.parseDouble(nowareaPopPropHm.getTotalUsers());
		double beforeUc = Double.parseDouble(areaPopPropHmbefore
				.getTotalUsers());
		if (nowUc == 0 || beforeUc == 0) {
			return String.valueOf(nowUc);
		} else {
			return String.valueOf(nowUc / beforeUc * nowUc).split("\\.")[0];
		}
	}
	
	/**
	 * 区域未来15分钟客流预测
	 * @Description: TODO
	 * @param @param nowareaPopPropHm
	 * @param @param areaPopPropHmbefore
	 * @param @return   
	 * @return String  
	 * @throws
	 * @author zhangyaoyao
	 * @date 2018年3月23日
	 */
	public static String getAreaNextFifteenUc(BdapAreaPopPropQm nowareaPopPropHm,
			BdapAreaPopPropQm areaPopPropHmbefore) {
		if (areaPopPropHmbefore == null || nowareaPopPropHm == null) {
			return "暂无";
		}
		double nowUc = Double.parseDouble(nowareaPopPropHm.getTotalUsers());
		double beforeUc = Double.parseDouble(areaPopPropHmbefore
				.getTotalUsers());
		if (nowUc == 0 || beforeUc == 0) {
			return String.valueOf(nowUc);
		} else {
			return String.valueOf(nowUc / beforeUc * nowUc).split("\\.")[0];
		}
	}
	
	/**
	 * 子区域未来15分钟客流预测
	 * @Description: TODO
	 * @param @param nowareaPopPropHm
	 * @param @param areaPopPropHmbefore
	 * @param @return   
	 * @return String  
	 * @throws
	 * @author zhangyaoyao
	 * @date 2018年3月23日
	 */
	public static String getSubAreaNextFifteenUc(BdapSubareaPopPropQm nowareaPopPropHm,
			BdapSubareaPopPropQm areaPopPropHmbefore) {
		if (areaPopPropHmbefore == null || nowareaPopPropHm == null) {
			return "暂无";
		}
		double nowUc = Double.parseDouble(nowareaPopPropHm.getTotalUsers());
		double beforeUc = Double.parseDouble(areaPopPropHmbefore
				.getTotalUsers());
		if (nowUc == 0 || beforeUc == 0) {
			return String.valueOf(nowUc);
		} else {
			return String.valueOf(nowUc / beforeUc * nowUc).split("\\.")[0];
		}
	}
}
